

//**************************C:\wamp\www\nd/utils/easing/Back.js**************************



function Back() {}

		

Back.easeIn = function ( p_t , p_b, p_c , p_d )
{
	return p_c * ( p_t /= p_d ) * p_t * ( 2.70158 * p_t - 1.70158 ) + p_b;
};


Back.easeOut = function (p_t, p_b, p_c, p_d)
{
	return p_c * ( ( p_t = p_t / p_d - 1) * p_t * ( 2.70158 * p_t + 1.70158) + 1 ) + p_b;
};

Back.easeInOut = function( p_t, p_b, p_c, p_d ) 
{
	if ( ( p_t /= p_d * 0.5 ) < 1 )
	{
		return p_c * 0.5 * ( p_t * p_t * ( ( 1.70158 * 1.525 + 1 ) * p_t - 1.70158 ) ) + p_b;
	}
	else
	{
		return p_c / 2 * ( ( ( p_t -= 2 ) * p_t * ( 1.70158 * 1.525 + 1 ) * p_t + 1.70158 ) + 2 ) + p_b;
	}
	
};



//**************************C:\wamp\www\nd/utils/easing/Bounce.js**************************



function Bounce() {}

Bounce.easeIn = function ( t , b, c , d )
{
	return c - easeOut(d-t, 0, c, d) + b;
};

Bounce.easeOut = function (t, b, c, d)
{
	if ((t/=d) < (1/2.75)) 
	{
		return c*(7.5625*t*t) + b;
	} 
	else if (t < (2/2.75)) 
	{
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} 
	else if (t < (2.5/2.75)) 
	{
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} 
	else 
	{
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
};

Bounce.easeInOut = function( t, b, c, d ) 
{
	if (t < d*0.5) 
	{
		return Bounce.easeIn (t*2, 0, c, d) * .5 + b;
	}
	else 
	{
		return Bounce.easeOut (t*2-d, 0, c, d) * .5 + c*.5 + b;
	}	
};




//**************************C:\wamp\www\nd/utils/easing/Circ.js**************************



function Circ(){}

	
Circ.easeIn = function(t, b, c, d) 
{
	return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
};

Circ.easeOut = function(t, b, c, d) 
{
	return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
};

Circ.easeInOut = function(t, b, c, d) 
{
	if ((t/=d*0.5) < 1) return -c*0.5 * (Math.sqrt(1 - t*t) - 1) + b;
	return c*0.5 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
};



//**************************C:\wamp\www\nd/utils/easing/Cubic.js**************************


function Cubic() {}
	
Cubic.easeIn = function(t, b, c, d) 
{
	return c*(t/=d)*t*t + b;
};

Cubic.easeOut = function(t, b, c, d) 
{
	return c*((t=t/d-1)*t*t + 1) + b;
};

Cubic.easeInOut = function(t, b, c, d) 
{
	if ((t/=d*0.5) < 1) return c*0.5*t*t*t + b;
	return c*0.5*((t-=2)*t*t + 2) + b;
};



//**************************C:\wamp\www\nd/utils/easing/Elastic.js**************************


function Elastic() {}

Elastic._2PI = Math.PI * 2;
	
Elastic.easeIn = function(t, b, c, d, a, p) 
{

	var s;
	a = a || 0;
	p = p || 0;
	if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
	if (!a || (c > 0 && a < c) || (c < 0 && a < -c)) { a=c; s = p/4; }
	else s = p/Elastic._2PI * Math.asin (c/a);
	return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*Elastic._2PI/p )) + b;
};

Elastic.easeOut  = function(t, b, c, d, a, p ) 
{
	var s;
	a = a || 0;
	p = p || 0;
	if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
	if (!a || (c > 0 && a < c) || (c < 0 && a < -c)) { a=c; s = p/4; }
	else s = p/Elastic._2PI * Math.asin (c/a);
	return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*Elastic._2PI/p ) + c + b);
};

Elastic.easeInOut = function (t, b, c, d, a, p) 
{
	var s;
	a = a || 0;
	p = p || 0;
	if (t==0) return b;  if ((t/=d*0.5)==2) return b+c;  if (!p) p=d*(.3*1.5);
	if (!a || (c > 0 && a < c) || (c < 0 && a < -c)) { a=c; s = p/4; }
	else s = p/Elastic._2PI * Math.asin (c/a);
	if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*Elastic._2PI/p )) + b;
	return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*Elastic._2PI/p )*.5 + c + b;
};



//**************************C:\wamp\www\nd/utils/easing/Expo.js**************************

﻿
function Expo (){}

Expo.easeIn = function(t, b, c, d) 
{
	return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b - c * 0.001;
};

Expo.easeOut = function(t, b, c, d) 
{
	return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
};

Expo.easeInOut = function(t, b, c, d) 
{
	if (t==0) return b;
	if (t==d) return b+c;
	if ((t/=d*0.5) < 1) return c*0.5 * Math.pow(2, 10 * (t - 1)) + b;
	return c*0.5 * (-Math.pow(2, -10 * --t) + 2) + b;
};



//**************************C:\wamp\www\nd/utils/easing/Linear.js**************************

/**
 * ...
 * @author HTML5
 */

function Linear() {}

Linear.power = 0;
Linear.easeNone = function(t, b, c, d)
{
	return c*t/d + b;
};

Linear.easeIn = function(t, b, c, d)
{
	return c*t/d + b;
};

Linear.easeOut = function(t, b, c, d)
{
	return c*t/d + b;
};

Linear.easeInOut = function(t, b, c, d)
{
	return c*t/d + b;
};



//**************************C:\wamp\www\nd/utils/easing/Quad.js**************************

function Quad(){}
		
Quad.easeIn = function(t, b, c, d) 
{
	return c*(t/=d)*t + b;
};

Quad.easeOut = function(t, b, c, d) 
{
	return -c *(t/=d)*(t-2) + b;
};

Quad.easeInOut = function( t, b, c, d) 
{
	if ((t/=d*0.5) < 1) return c*0.5*t*t + b;
	return -c*0.5 * ((--t)*(t-2) - 1) + b;
};



//**************************C:\wamp\www\nd/utils/easing/Quart.js**************************


function Quart(){}
	
	
Quart.easeIn = function(t, b, c, d) 
{
	return c*(t/=d)*t*t*t + b;
};

Quart.easeOut = function(t, b, c, d) 
{
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

Quart.easeInOut = function(t, b, c, d) 
{
	if ((t/=d*0.5) < 1) return c*0.5*t*t*t*t + b;
	return -c*0.5 * ((t-=2)*t*t*t - 2) + b;
};



//**************************C:\wamp\www\nd/utils/easing/Quint.js**************************


function Quint() {}
	
Quint.easeIn  = function(t, b, c, d) 
{
	return c*(t/=d)*t*t*t*t + b;
};

Quint.easeOut  = function(t, b, c, d) 
{
	return c*((t=t/d-1)*t*t*t*t + 1) + b;
};

Quint.easeInOut  = function(t, b, c, d) 
{
	if ((t/=d*0.5) < 1) return c*0.5*t*t*t*t*t + b;
	return c*0.5*((t-=2)*t*t*t*t + 2) + b;
};



//**************************C:\wamp\www\nd/utils/easing/Sine.js**************************


function Sine(){}

Sine._HALF_PI = Math.PI * 0.5;

Sine.easeIn  = function(t, b, c, d) 
{
	return -c * Math.cos(t/d * _HALF_PI) + c + b;
};

Sine.easeOut  = function(t, b, c, d) 
{
	return c * Math.sin(t/d * _HALF_PI) + b;
};

Sine.easeInOut  = function(t, b, c, d) 
{
	return -c*0.5 * (Math.cos(Math.PI*t/d) - 1) + b;
};



//**************************C:\wamp\www\nd/utils/easing/Strong.js**************************

﻿
function Strong() {}

Strong.easeIn  = function(t, b, c, d) 
{
	return c*(t/=d)*t*t*t*t + b;
};

Strong.easeOut  = function(t, b, c, d) 
{
	return c*((t=t/d-1)*t*t*t*t + 1) + b;
};

Strong.easeInOut  = function(t, b, c, d) 
{
	if ((t/=d*0.5) < 1) return c*0.5*t*t*t*t*t + b;
	return c*0.5*((t-=2)*t*t*t*t + 2) + b;
};




//**************************C:\wamp\www\nd/utils/easing/TweenNano.js**************************



	
	function TweenNano ( p_target, p_duration, p_vars, p_cadency )
	{
		
		var _public = this;
		
		
		// private
		
		_public._cadency		= 100;
		_public._time 			= 0;

		
		// public 
		
		_public.duration 		= p_duration;
		_public.vars 			= new Object();
		_public.startTime 		= 0;
		_public.target			= new Object();
		_public.active			= false;
		_public.gc				= false;
		_public.useFrames		= false;
		_public.ratio			= 0;
		
		// protected
		
		_public._ease			= _public.defaultEaseOut;
		_public._propTweens		= new Array();
		
		_public.reservedProperties = ["ease","delay","useFrames","overwrite","onComplete","onCompleteParams","runBackwards","immediateRender","onUpdate","onUpdateParams"];
			
		
		
		
				
		_public._construct 		= function( p_target, p_duration, p_vars, p_cadency )
		{
			
			p_target.tweenId = "tween_"+TweenNano._tweenIds++;
			
			if( TweenNano._masterList[ p_target.tweenId ] )
			{
				TweenNano._masterList[ p_target.tweenId ].complete(false);
			}
			
			
			
			TweenNano._masterList[ p_target.tweenId ] = this;
			
			
			_public._time = new Date().getTime();
			
			_public.vars = p_vars;
			_public.duration = p_duration;
			_public.target = p_target;
			
			_public._ease = ( typeof( _public.vars.ease ) == "function" ) ? _public.vars.ease : _public.defaultEaseOut;
			_public._cadency = ( p_cadency == undefined ) ? 100 : p_cadency;
			
			_public._propTweens = new Array();
			
			_public.useFrames = false;
			_public.delay = ( typeof( _public.vars.delay ) == "undefined" ) ? 0 : new Number( _public.vars.delay );
			
			
			
			_public.startTime = _public._time + _public.delay;
			_public.renderTime(0);
			
			_public.init();
			
			FrameManager.getInstance().addFrameListener( _public.update, _public );
			
		};
		
		
		_public.defaultEaseOut 	= function( p_t, p_b, p_c, p_d )
		{
			return ( -1 * ( p_t /= p_d ) * ( p_t - 2 ) );
		};	
		
		
		_public.renderTime 		= function( p_time )
		{
			
			var l_prop = new Array();
			var i = _public._propTweens.length;
			
			
			
			
			
			if ( p_time >= _public.duration ) 
			{
				p_time = _public.duration;
				_public.ratio = 1;
			} 
			else if ( p_time <= 0 ) 
			{
				_public.ratio = 0;
			} 
			else 
			{
				_public.ratio = _public._ease( p_time, 0, 1, _public.duration );			
			}
			
			while (--i > -1) 
			{
				l_prop = _public._propTweens[i];
				_public.target[ l_prop[0] ] = l_prop[1] + ( _public.ratio * l_prop[2] ); 
				
				//alert( _public.target[ l_prop[0] ]+", "+_public.ratio+","+l_prop[0]+","+l_prop[1]+","+l_prop[2] );
			}
			
			
			if (typeof(_public.vars.onUpdate) == "function") 
			{
				_public.vars.onUpdate.apply( _public.target, _public.vars.onUpdateParams );
			}
			
			if ( p_time >= _public.duration && !_public.gc ) 
			{
				_public.complete(true);
			}
			
		};
		
		
		_public.init 			= function()
		{
			
			var l_prop;
			var i = 0;
			for ( l_prop in _public.vars) 
			{
				if( _public.reservedProperties.indexOf(l_prop) == -1 )
				{
					_public._propTweens[i] = [l_prop, _public.target[l_prop], new Number( _public.vars[l_prop] - _public.target[l_prop] ) ];
					
					i++;
				}
			}
			
		};
		
		
		_public.complete 		= function( p_complete )
		{		
		
			if ( p_complete && !_public.gc ) 
			{
				_public.gc = true;
				_public.renderTime( _public.duration );
			}
			
			_public.kill();
		
			
			if (_public.vars.onComplete) 
			{
				_public.vars.onComplete.apply( null, _public.vars.onCompleteParams );
			}
		};
			
		
		_public.kill 			= function() 
		{
			delete TweenNano._masterList[ _public.target.tweenId ];
			_public.gc = true;
			
			FrameManager.getInstance().removeFrameListener( _public.update, _public );
		};
		
		
		_public.update 			= function()
		{
			_public._time = new Date().getTime();
			_public.renderTime( _public._time - _public.startTime);
		};
			
			
		
		
		_public._construct( p_target, p_duration, p_vars, p_cadency );
		
		
	}

	

	
	

		
	// static
		
	TweenNano._masterList 				= new Array();
	TweenNano._tweenIds					= 0;
		
	/* static methods */
	
	TweenNano.kill = function( p_target, p_complete )
	{
		p_complete = ( p_complete == true ) ? true : false;
		if( TweenNano._masterList[ p_target.tweenId ] )
		{
			TweenNano._masterList[ p_target.tweenId ].complete( p_complete );
		}
	};
	
	TweenNano.killAll = function( p_target, p_complete )
	{
		var id = "";
		p_complete = ( p_complete == true ) ? true : false;
		
		for( id in TweenNano._masterList )
		{
			TweenNano._masterList[ id ].complete( p_complete );
		}
	};
	
	
	TweenNano.to = function( p_target, p_duration , p_vars, p_cadency ) 
	{
		return new TweenNano( p_target, p_duration, p_vars, p_cadency );
	};
	
	TweenNano.delayer = function( p_delay, p_target, p_duration, p_vars, p_cadency )
	{
		setTimeout( function()
		{
			TweenNano.to( p_target, p_duration, p_vars, p_cadency );
		}, p_delay );
	};
	
		
	TweenNano.delayedCall = function( p_delay, p_onComplete, p_onCompleteParams, p_useFrames )
	{
		return new TweenNano( p_onComplete, 0, { delay: p_delay, onComplete: p_onComplete, onCompleteParams: p_onCompleteParams, useFrames: p_useFrames, overwrite:false } );
	};
	
	



//**************************C:\wamp\www\nd/utils/net/ImageLoader.js**************************

/**
 * ...
 * @author HTML5
 */
 
function ImageLoader()
{
	
	var _public = this;
	var m_currentId = "";
	var m_total = 0;
	var m_files = new Array();
	var m_data = new Object();
	_public.signal = new Signal();
	
	
	
	
	
	_public.addFile = function( p_file, p_id )
	{
		m_files.push( {url:p_file, id:p_id} );
	};
	
	
	_public.load = function()
	{
		m_total = m_files.length;
		loadNextFile();
	};
	
	
	function loadNextFile()
	{
		var l_img = new Image();
		var l_obj;
		
		if( m_files.length == 0 )
		{	
			_public.signal.dispatchEvent(ImageLoader.LOAD_COMPLETE);
		}
		else
		{
			l_img.onload = completeHandler;
			l_obj = m_files.shift();
			m_currentId = l_obj.id;
			l_img.src = l_obj.url;
		}
	}
	
	
	function completeHandler(event)
	{
		var l_img = event.target;
		m_data[m_currentId] = l_img;
		
		_public.signal.dispatchEvent(ImageLoader.LOAD_PROGRESS);
		
		loadNextFile();	
	};
	
	_public.getProgression = function()
	{
		return parseInt( ( m_total - m_files.length ) / m_total * 100 );
	};
	
	_public.clean = function()
	{
		m_files = new Array();
		m_data = new Object();
	}
	
	_public.getData = function()
	{
		return m_data;
	};
	
	_public.getDataById = function( p_id )
	{
		return m_data[p_id];
	};
	
	_public.destroy = function()
	{
		m_files = null;
		m_data = null;
		delete this;
	}
	
}

ImageLoader.signal = null;

ImageLoader.LOAD_COMPLETE = "loadComplete";
ImageLoader.LOAD_PROGRESS = "loadProgress";



//**************************C:\wamp\www\nd/utils/poo/POO.js**************************

/**
 * ...
 * @author HTML5
 */

//------------------------------------------------
//---------------------POO EMULATION--------------
//------------------------------------------------
//------------------------------------------------

function POO(){}

	// static 
	POO._extends = new Array();
	
	POO.extend = function( p_child, p_ancestor )
	{
		POO._extends.push({"child":p_child,"ancestor":p_ancestor});
	};

	POO.run = function()
	{
		var obj = null;
		var i = 0;
		var max = POO._extends.length;
		var prop = null;
		
		for (i = 0; i < max; i++ )
		{
			
			obj = POO._extends[i];
			
			
			for( prop in obj.ancestor.prototype )
			{
				if( typeof(obj.child.prototype[prop]) == "undefined" )
				{
					obj.child.prototype[prop] = obj.ancestor.prototype[prop];
				}
				
				obj.child.prototype._super = obj.child.prototype._super || {};
				obj.child.prototype._super[prop] = obj.ancestor.prototype[prop];
			}
			
		}
	}



//**************************C:\wamp\www\nd/utils/signal/Signal.js**************************

function Signal()
{
	this._listeners = new Array();
}

Signal.prototype._listeners = null;


Signal.prototype.destroy = function()
{
	this._listeners = null;
};

Signal.prototype.addListener = function( p_eventType, p_callback, p_context )
{
	this._listeners.push( {type:p_eventType, callback:p_callback, context:p_context} );
};

Signal.prototype.removeListener = function( p_eventType, p_callback, p_context )
{
	var listeners = new Array();
	var max = this._listeners.length;
	var listener = null;
	var i = 0;
	
	for( i = 0; i < max; i++ )
	{
		listener = this._listeners[i];
		if( listener.type == p_eventType && listener.callback == p_callback && listener.context == p_context )
		{
			continue;
		}
		listeners.push( listener );
	}
	
	this._listeners = listeners;
};

Signal.prototype.dispatchEvent = function( p_eventType, p_params )
{
	
	var params = p_params || null;
	var max = this._listeners.length;
	var listener = null;
	var calls = new Array();
	var i = 0;
	
	
	for( i = 0; i < max; i++ )
	{
		listener = this._listeners[i];
		if( listener.type == p_eventType )
		{
			calls.push(listener);
		}
	}
	
	max = calls.length;
	
	for( i = 0; i < max; i++ )
	{
		listener = calls[i];
		listener.callback.apply( listener.context, params );
	}
	
};



//**************************C:\wamp\www\nd/utils/ui/KeyboardTracker.js**************************

/**
 * ...
 * @author Thot
 */

function KeyboardTracker(){}


KeyboardTracker.KEY_DOWN 	= "keydown";
KeyboardTracker.KEY_UP 		= "keyup";

KeyboardTracker.prototype._element 	= null;
KeyboardTracker.prototype._signal 	= null;
KeyboardTracker.prototype._keyStates = null;


KeyboardTracker.prototype.listen = function()
{
	var _context = this;
	var callBack = function(event)
	{
		_context.keyHandler.apply( _context, [event] );
	};
	
	document.onkeyup 	= callBack;
	document.onkeydown 	= callBack;
	
	this.signal = new Signal();
	this._keyStates = new Object();
};


KeyboardTracker.prototype.keyHandler = function(event)
{
	var character = String.fromCharCode(event.keyCode).toLowerCase();
	var state = 0;
	
	switch( event.type )
	{
		case "keyup":		
			state = 0; 
			this.signal.dispatchEvent( KeyboardTracker.KEY_UP, character ); 		
			break;
			
		case "keydown":		
			state = 1; 
			this.signal.dispatchEvent( KeyboardTracker.KEY_DOWN, character ); 	
			break;
	}
	
	this._keyStates[character] = state;
};


KeyboardTracker.prototype.getKeyState = function( p_key )
{
	if( this._keyStates[p_key] )
	{
		return this._keyStates[p_key];
	}
	else
	{
		return 0;
	}
};




//**************************C:\wamp\www\nd/utils/ui/MouseTracker.js**************************

/**
 * ...
 * @author HTML5
 */
 
 
MouseTracker.MOUSE_UP = "mouseUp";
MouseTracker.MOUSE_DOWN = "mouseDown";
MouseTracker.DOUBLE_CLICK = "doubleClick";
 
function MouseTracker( p_element ) 
{
	
	var m_element = p_element || document;
	var _public = this;
	var _lastTime = 0;
	
	this.down = false;
	this.lastX = 0;
	this.lastY = 0;
	this.mouseX = 0;
	this.mouseY = 0;
	this.localX = 0;
	this.localY = 0;
	this.skip  = 0;
	this.signal = new Signal();
	
	function touchHandler(event)
	{
		
		var l_time = new Date().getTime();
		var l_touches = event.changedTouches;
		
		if( event.type == "touchstart" )
		{
			event.preventDefault();
			
			if( l_time - _lastTime < 500 )
			{
				_public.signal.dispatchEvent( MouseTracker.DOUBLE_CLICK );
			}
			
			
			_public.down = true;
			_public.lastX = l_touches[0].pageX;
			_public.lastY = l_touches[0].pageY;
			_public.signal.dispatchEvent( MouseTracker.MOUSE_DOWN );
			
			_lastTime = l_time;
		}
		else if( event.type == "touchend" )
		{
			_public.down = false;
			_public.lastX = l_touches[0].pageX;
			_public.lastY = l_touches[0].pageY;
			_public.signal.dispatchEvent( MouseTracker.MOUSE_UP );
		}
		else
		{
			event.preventDefault();
			this.skip = ( this.skip + 1 ) % 4;			
			
			if( this.skip < 3 )
				return;
		}
		
		_public.mouseX = l_touches[0].pageX;
		_public.mouseY = l_touches[0].pageY;
	}
	
	function mouseHandler(event)
	{
	
		var l_time = new Date().getTime();
		var l_touches = event.changedTouches;
		
		if( event.type == "mousedown" )
		{
			event.preventDefault();
			
			if( l_time - _lastTime < 500 )
			{
				_public.signal.dispatchEvent( MouseTracker.DOUBLE_CLICK );
			}
			
			_public.down = true;
			_public.lastX = event.pageX;
			_public.lastY = event.pageY;
			_public.signal.dispatchEvent( MouseTracker.MOUSE_DOWN );
			
			_lastTime = l_time;
		}
		else if( event.type == "mouseup" )
		{
			_public.down = false;
			_public.lastX = event.pageX;
			_public.lastY = event.pageY;
			_public.signal.dispatchEvent( MouseTracker.MOUSE_UP );
		}
		else
		{
			this.skip = ( this.skip + 1 ) % 5;
			
			if( this.skip < 4 )
				return;
		}
		
		_public.mouseX = event.pageX;
		_public.mouseY = event.pageY;
		_public.localX = event.layerX;
		_public.localY = event.layerY;
	}
	

	m_element.addEventListener( "touchmove", 	 touchHandler );
	m_element.addEventListener( "touchstart", 	 touchHandler );
	m_element.addEventListener( "touchend", 	 touchHandler );
	
	m_element.addEventListener("mousemove", 	mouseHandler );
	m_element.addEventListener("mouseup", 		mouseHandler );
	m_element.addEventListener("mousedown", 	mouseHandler );
	

	
}



//**************************C:\wamp\www\nd/utils/ui/ResizeTracker.js**************************

/**
 * ...
 * @author HTML5
 */
 
 
ResizeTracker.RESIZE = "resize";
 
function ResizeTracker() 
{
	this.signal = new Signal();
	var _public = this;
	
	function resizeHandler(event)
	{
		_public.signal.dispatchEvent( ResizeTracker.RESIZE );
	}
	
	window.addEventListener( "resize", 	 resizeHandler );
}




//**************************C:\wamp\www\nd/utils/utils/FrameManager.js**************************

function FrameManager()
{
	this.signal = new Signal();
	var _this = this;
	
	
	function render()
	{
		_this.signal.dispatchEvent( FrameManager.ENTER_FRAME );
		window.requestAnimationFrame( render );
	}
	
	render();
}



// static
FrameManager.ENTER_FRAME = "enterFrame";
FrameManager._instance = null;

FrameManager.getInstance = function()
{
	if( FrameManager._instance == null )
	{
		FrameManager._instance = new FrameManager();
	}
	
	return FrameManager._instance;
};


// public

FrameManager.prototype.signal = null;

FrameManager.prototype.addFrameListener = function( p_callback, p_context )
{
	this.signal.addListener( FrameManager.ENTER_FRAME, p_callback, p_context );
};

FrameManager.prototype.removeFrameListener = function( p_callback, p_context )
{
	this.signal.removeListener( FrameManager.ENTER_FRAME, p_callback, p_context );
};

// useful
window.requestAnimationFrame = (function()
{
	
    return  window.requestAnimationFrame       ||  //Chromium 
            window.webkitRequestAnimationFrame ||  //Webkit
            window.mozRequestAnimationFrame    || //Mozilla Geko
            window.oRequestAnimationFrame      || //Opera Presto
            window.msRequestAnimationFrame     || //IE Trident?
            function(callback, element){ //Fallback function
                window.setTimeout(callback, 16);                
            }
     
})();




//**************************C:\wamp\www\nd/utils/utils/Utils.js**************************

/**
 * ...
 * @author HTML5
 */

// DOM utilities

function Utils(){}

Utils.getInnerHeight = function ()
{
	return window.innerHeight;
	//return document.body.offsetHeight;
};

Utils.getInnerWidth = function ()
{
	return window.innerWidth;
	//return document.body.offsetHeight;
};


Utils.$ = function(p_id)
{
	return document.getElementById(p_id);
};

Utils.$$ = function(p_tagName)
{
	return document.getElementsByTagName(p_tagName);
};




